import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
from selenium.webdriver.support.select import Select
testCase="DBshop011_后台商品管理--添加商品流程"

firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,'商品管理','管理商品')
firefox.find_element_by_xpath('//a[@href="/dbshop/admin/goods/goods/add"]').click()
firefox.find_element_by_id('goods_name').send_keys('苹果XXR')
firefox.find_element_by_id('goods_shop_price').send_keys(7999)
Select(firefox.find_element_by_id('goods_type')).select_by_visible_text('虚拟商品')
time.sleep(1)
firefox.find_element_by_xpath('//button[@type="submit"]').click()

a=firefox.find_element_by_xpath('//table/tbody/tr[2]/td[5]').text
print('a=',a)
if a==('7999'):
    print('%s   测试通过'%testCase)
else:
    print('%s   测试失败'%testCase)

time.sleep(2)
firefox.quit()

# firefox.quit()

# firefox=openBrowser(url)
# DBshopLogin(firefox,userName,password)
#
# firefox.find_element_by_link_text("我的订单").click()
# firefox.find_element_by_link_text('退货申请').click()
#
# a=firefox.find_element_by_xpath('//table/tbody/tr/td[4]').text
# if a == ('退款成功'):
#     print('%s   测试通过'%testCase)
# else:
#     print('%s   测试失败'%testCase)
#
# time.sleep(2)
# firefox.quit()